<?php
    include "header.html";
?>
<link href="/css/login.css" rel="stylesheet" type="text/css">
<div class="mid">
  <h2 class="f12">
    <b class="ico-bc"></b>
    <a href="/register.php?type=user"><bold>新用户注册</bold></a>
    <span class="ico-nav"></span>
    <a href="/register.php?type=group">新群组注册</a>
    <span class="ico-nav"></span>
    <a href="/register.php?type=company">新公司注册</a>
  </h2>
</div>
<div id="container" class="container" onselectstart="return false;"> 
  <div class="wrapper mid" id="datawrap">
      <!--主体 S-->
      <div class="main"> 
        <?php
        if ($type == "user")
        {
        ?>
<!--breadcrumb S-->
        <div id="page">
        <form id="login" action="register.php?type=<?php echo $type?>" method="post">
            <?php if ($failed) { ?><p class="p1">注册失败，请重新输入</p> <?php } ?>
            <p class="p1">用户注册信息</p>
            <p class="p1"><label for="vwriter">用户名：</label><input id="vwriter" name="username" value="<?php echo $username ?>" type="text" /></p>
            <p class="p2"><label for="vpassword">密　码：</label><input id="vpassword" class="basicInput" name="passwd" type="password" /></p>
            <p class="p1"><label for="email">邮箱地址：</label><input id="email" name="email" value="<?php echo $email; ?>" type="text" /></p>
            <p class="p1"><label for="company">公司：</label>
            <select id="companyid" name="companyid">
                <?php
                    foreach($companys as $company)
                    {
                ?>
                <option value="<?php echo $company['id']; ?>"><?php echo $company['name']; ?></option>
                <?php
                    }
                ?>
            </select></p>
            <p class="p1"><label for="typeid">用户类型：</label><select id="typeid" name="typeid"><option value="1">普通用户</option><option value="2">管理员</option></select></p>
            <input name="register" value="1" hidden="true" />
            <input class="submit" name="submit" type="submit" value="注册" />
        </form>
        </div>
        <?php
        }elseif ($type == "group")
        {
        ?>
        <div id="page">
        <form id="login" action="register.php?type=<?php echo $type?>" method="post">
            <?php if ($failed) { ?><p class="p1">注册失败，请重新输入</p> <?php } ?>
            <p class="p1">群组注册信息</p>
            <p class="p1"><label for="vwriter">群组名：</label><input id="vwriter" name="username" value="<?php echo $username ?>" type="text" /></p>
            <p class="p2"><label for="vpassword">密　码：</label><input id="vpassword" class="basicInput" name="passwd" type="password" /></p>
            <p class="p1"><label for="email">邮箱地址：</label><input id="email" name="email" value="<?php echo $email; ?>" type="text" /></p>
            <p class="p1"><label for="company">公司：</label>
            <select id="companyid" name="companyid">
                <?php
                    foreach($companys as $company)
                    {
                ?>
                <option value="<?php echo $company['id']; ?>"><?php echo $company['name']; ?></option>
                <?php
                    }
                ?>
            </select></p>
            <input name="typeid" value="3" hidden="true" />
            <input name="register" value="1" hidden="true" />
            <input class="submit" name="submit" type="submit" value="注册" />
        </form>
        </div>
        <?php
        }elseif ($type == "company")
        {
        ?>
        <div id="page">
        <form id="login" action="register.php?type=<?php echo $type?>" method="post">
            <?php if ($failed) { ?><p class="p1">注册失败，请重新输入</p> <?php } ?>
            <p class="p1">公司注册信息</p>
            <p class="p1"><label for="vwriter">公司名：</label><input id="vwriter" name="name" value="<?php echo $username ?>" type="text" /></p>
            <p class="p1"><label for="name">所有者姓名：</label><input id="owner" name="owner" value="<?php echo $owner; ?>" type="text" /></p>
            <p class="p1"><label for="tel">联系电话：</label><input id="tel" name="tel" value="<?php echo $tel; ?>" type="text" /></p>
            <input name="company" value="1" hidden="true" />
            <input name="register" value="1" hidden="true" />
            <input class="submit" name="submit" type="submit" value="注册" />
            </div>
        </form>
        <?php
        }else {
            echo "<h1>不能识别操作类型: $type</h1>";
        }
        ?>
    </div>
  </div>
</div>
    </body>
</html>
